function init(){
    ///用户名检验置空
    document.getElementById("userName").addEventListener("focus",()=>{
        document.querySelector(".userName_error_msg").innerHTML="";
        document.querySelector(".userName_error_img").classList.remove("errorImg");
        document.querySelector(".userName_error_msg").classList.remove("errorMessage");
        document.querySelector(".userName_error_msg").classList.remove("okMessage");
        document.querySelector(".userName_error_img").classList.remove("okImg");
    },false);
    ///用户名检验
    document.getElementById("userName").addEventListener("blur",()=>{
        let regExp=/^[a-zA-Z0-9_]+$/;
        if(!regExp.test(document.getElementById("userName").value)){
            document.querySelector(".userName_error_msg").innerHTML="用户名格式不正确";
            document.querySelector(".userName_error_msg").classList.add("errorMessage");
            document.querySelector(".userName_error_img").classList.add("errorImg");
        }else{
            document.querySelector(".userName_error_msg").innerHTML="用户名格式符合要求";
            document.querySelector(".userName_error_msg").classList.add("okMessage");
            document.querySelector(".userName_error_img").classList.add("okImg");
        }
    },false);
    ///昵称检验置空
    document.getElementById("nickName").addEventListener("focus",()=>{
        document.querySelector(".nickName_error_msg").innerHTML="";
        document.querySelector(".nickName_error_img").classList.remove("errorImg");
        document.querySelector(".nickName_error_msg").classList.remove("errorMessage");
        document.querySelector(".nickName_error_msg").classList.remove("okMessage");
        document.querySelector(".nickName_error_img").classList.remove("okImg");
    },false);
    ///昵称检验
    document.getElementById("nickName").addEventListener("blur",()=>{
        let regExp=/\S/;
        if(!regExp.test(document.getElementById("nickName").value)){
            document.querySelector(".nickName_error_msg").innerHTML="昵称格式不正确";
            document.querySelector(".nickName_error_msg").classList.add("errorMessage");
            document.querySelector(".nickName_error_img").classList.add("errorImg");
        }else{
            document.querySelector(".nickName_error_msg").innerHTML="昵称格式符合要求";
            document.querySelector(".nickName_error_msg").classList.add("okMessage");
            document.querySelector(".nickName_error_img").classList.add("okImg");
        }
    },false);
    ///email检验置空
    document.getElementById("email").addEventListener("focus",()=>{
        document.querySelector(".email_error_msg").innerHTML="";
        document.querySelector(".email_error_img").classList.remove("errorImg");
        document.querySelector(".email_error_msg").classList.remove("errorMessage");
        document.querySelector(".email_error_msg").classList.remove("okMessage");
        document.querySelector(".email_error_img").classList.remove("okImg");
    },false);
    ///email检验
    document.getElementById("email").addEventListener("blur",()=>{
        let regExp=/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
        if(!regExp.test(document.getElementById("email").value)){
            document.querySelector(".email_error_msg").innerHTML="邮箱格式不正确";
            document.querySelector(".email_error_msg").classList.add("errorMessage");
            document.querySelector(".email_error_img").classList.add("errorImg");
        }else{
            document.querySelector(".email_error_msg").innerHTML="邮箱格式符合要求";
            document.querySelector(".email_error_msg").classList.add("okMessage");
            document.querySelector(".email_error_img").classList.add("okImg");
        }
    },false);
    ///密码检验置空
    document.getElementById("password").addEventListener("focus",()=>{
        document.querySelector(".password_error_msg").innerHTML="";
        document.querySelector(".password_error_img").classList.remove("errorImg");
        document.querySelector(".password_error_msg").classList.remove("errorMessage");
        document.querySelector(".password_error_msg").classList.remove("okMessage");
        document.querySelector(".password_error_img").classList.remove("okImg");
    },false);
    ///密码检验
    let pass1;
    document.getElementById("password").addEventListener("blur",()=>{
        let pass=/^.{8,20}$/;
        if(!pass.test(document.getElementById("password").value)){
            pass1=document.getElementById("password").value;
            
            document.querySelector(".password_error_msg").innerHTML="密码格式不正确";
            document.querySelector(".password_error_msg").classList.add("errorMessage");
            document.querySelector(".password_error_img").classList.add("errorImg");
        }else{
            document.querySelector(".password_error_msg").innerHTML="密码格式符合要求";
            document.querySelector(".password_error_msg").classList.add("okMessage");
            document.querySelector(".password_error_img").classList.add("okImg");
        }
    },false);
    ///重复密码检验置空
    document.getElementById("rePassword").addEventListener("focus",()=>{
        document.querySelector(".rePassword_error_msg").innerHTML="";
        document.querySelector(".rePassword_error_img").classList.remove("errorImg");
        document.querySelector(".rePassword_error_msg").classList.remove("errorMessage");
        document.querySelector(".rePassword_error_msg").classList.remove("okMessage");
        document.querySelector(".rePassword_error_img").classList.remove("okImg");
    },false);
    ///重复密码检验
    
    document.getElementById("rePassword").addEventListener("blur",()=>{
        let repass=document.getElementById("rePassword").value;
        if(repass!=pass1){            
            document.querySelector(".rePassword_error_msg").innerHTML="两次输入不相等";
            document.querySelector(".rePassword_error_msg").classList.add("errorMessage");
            document.querySelector(".rePassword_error_img").classList.add("errorImg");
        }else{
            document.querySelector(".rePassword_error_msg").innerHTML="正确";
            document.querySelector(".rePassword_error_msg").classList.add("okMessage");
            document.querySelector(".rePassword_error_img").classList.add("okImg");
        }
    },false);    
    ///手机号检验置空
    document.getElementById("phone").addEventListener("focus",()=>{
        document.querySelector(".phone_error_msg").innerHTML="";
        document.querySelector(".phone_error_img").classList.remove("errorImg");
        document.querySelector(".phone_error_msg").classList.remove("errorMessage");
        document.querySelector(".phone_error_msg").classList.remove("okMessage");
        document.querySelector(".phone_error_img").classList.remove("okImg");
    },false);
    ///手机号检验
    document.getElementById("phone").addEventListener("blur",()=>{
        let regExp=/^1\d{10}$/;
        if(!regExp.test(document.getElementById("phone").value)){
            document.querySelector(".phone_error_msg").innerHTML="手机号格式不正确";
            document.querySelector(".phone_error_msg").classList.add("errorMessage");
            document.querySelector(".phone_error_img").classList.add("errorImg");
        }else{
            document.querySelector(".phone_error_msg").innerHTML="手机号格式符合要求";
            document.querySelector(".phone_error_msg").classList.add("okMessage");
            document.querySelector(".phone_error_img").classList.add("okImg");
        }
    },false);
}
window.addEventListener("load",init,false);

